import React, { FC, useState } from 'react';
import { View, Text } from '@tarojs/components';
import { styled } from 'linaria/react';
import { useClassName } from '@/utils/index';
import { useCollectionExhibitionList } from '@/pages/MyCollection/MyCollectionContext';
import RootPageComponent from '@/pages/components/RootPageComponent/RootPageComponent';
import RootPageComponentGotoMenu from '@/pages/components/RootPageComponentGotoMenu/RootPageComponentGotoMenu';
import MyCollectionList from './MyCollectionList/MyCollectionList';
import LoadingComponent from '@/pages/MyCollection/LoadingComponent/LoadingComponent';

export interface IProps extends ICompProps {}
MyCollection.defaultProps = {} as Partial<IProps>;
function MyCollection(props: IProps) {
    const { className, style } = props;
    const localClassName = useClassName('MyCollection', className);
    const { loadingStatus, CollectionExhibitionState, CollectionExhibitionDispatch } = useCollectionExhibitionList();
    return (
        <RootView className={localClassName} style={style}>
            <RootPageComponent
                enableExpand={false}
                leftTitle="我的收藏"
                headNavContentRightSlot={<RootPageComponentGotoMenu />}>
                <MyCollectionList
                    CollectionExhibitionState={CollectionExhibitionState}
                    CollectionExhibitionDispatch={CollectionExhibitionDispatch}></MyCollectionList>
                <LoadingComponent status={loadingStatus}></LoadingComponent>
            </RootPageComponent>
        </RootView>
    );
}
export default React.memo(MyCollection as FC<IProps>);
const RootView = styled(View)`
    &.MyCollection {
    }
`;
